public Election::addCandidate
Description
php
public Election->addCandidate ( [CondorcetPHP\Condorcet\Candidate|string|null $candidate = null] ): CondorcetPHP\Condorcet\Candidate
Add a candidate to an election.
Parameter
candidate: CondorcetPHP\Condorcet\Candidate|string|null
Alphanumeric string or CondorcetPHP\Condorcet\Candidate object. The candidate name's white spaces will be removed. If null, this function will create a new candidate with an automatic name.
Return value
(CondorcetPHP\Condorcet\Candidate
) The newly created candidate object (yours or automatically generated). Throws an exception in case of error (existing candidate...).
Throws:
CandidateExistsException
VotingHasStartedException
Related method(s)
- Election::parseCandidates
- Election::addCandidatesFromJson
- Election::removeCandidates
- Election::getCandidatesList
- Election::canAddCandidate